<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/usertemplate.xhtml">
        <ui:define name="head">
            <h:outputStylesheet library="css" name="fancy-button/fancy-button.css" target="head"/>
            <h:outputScript library="js" name="fancy-button/fancy-button.js" target="head"/>
        </ui:define>
        <ui:define name="title">
            <h:outputText value="User Profile"></h:outputText>
        </ui:define>
        <ui:define name="leftcontent">
            <h:form acceptcharset="UTF-8" enctype="multipart/form-data">
                <div class="pad_left1" id="a">
                    <h2 class="pad_bot1">#{studentsController.selected.userName}</h2>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            FullName: 
                        </strong>
                        <h:inputText id="fullName" value="#{studentsController.selected.fullName}" title="#{bundle.EditStudentsTitle_fullName}" />
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Class: 
                        </strong>
                        <h:outputText id="classes" value="#{studentsController.selected.classId.className}" title="#{bundle.EditStudentsTitle_fullName}" />
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Address:
                        </strong>
                        <h:inputText id="address" value="#{studentsController.selected.address}" title="#{bundle.EditStudentsTitle_address}" />
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            DOB:    
                        </strong>
                        <p:calendar id="dateOfBirth" yearRange="-50:0+" value="#{studentsController.selected.dateOfBirth}" title="#{bundle.EditStudentsTitle_dateOfBirth}" pattern="MM/dd/yyyy" showOn="button" /> 
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Gender:
                        </strong>
                        <h:selectOneMenu id="gender" value="#{studentsController.selected.gender}" title="#{bundle.EditStudentsTitle_gender}">
                                    <f:selectItem itemLabel="Male" itemValue="1" />
                                    <f:selectItem itemLabel="FeMale" itemValue="0" />
                        </h:selectOneMenu>
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Phone:
                        </strong>
                        <h:inputText id="phone" value="#{studentsController.selected.phone}" title="#{bundle.EditStudentsTitle_phone}" />
                    </p>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Email:
                        </strong>
                        <h:inputText id="email" value="#{studentsController.selected.email}" title="#{bundle.EditStudentsTitle_email}" />
                    </p>
                    <h:commandLink action="#{studentsController.updateForUser()}" class="button marg_left1">
                        <span><span>
                        #{bundle.EditCourseSaveLink}
                        </span></span>
                    </h:commandLink>
                    <p class="pad_bot1 pad_top2">
                        <strong>
                            Submitted :
                        </strong>
                    </p>
                    <h:dataTable value="#{studentCourseController.items}" var="item" class="wrapper pad_bot2">
                        <h:column>
                            <p class="pad_bot1 pad_top2">
                            </p>
                        </h:column>
                        <h:column>
                            <p class="pad_bot1 pad_top2">
                                ASSIGNMENT <a href=" #{courseController.linkDownload(item.fileUpload)}">#{item.fileUpload}</a> 
                            </p>
                        </h:column>
                        <h:column>  
                            <p class="pad_bot1 pad_top2">
                                IN COURSE <font color="blue">#{item.course.courseName}</font>
                            </p>
                        </h:column>
                        <h:column>
                            <p class="pad_bot1 pad_top2">
                                Mark 
                                <ui:fragment rendered="#{item.mark>0}">
                                   <font color="blue">#{item.mark}</font>
                                </ui:fragment>
                                <ui:fragment rendered="#{item.mark==0}">
                                    <font color="blue">(Not Mark)</font>
                                </ui:fragment>
                            </p>
                        </h:column>
                    </h:dataTable>
                </div>
            </h:form>
        </ui:define>
        <ui:define name="rightcontent">
            <h:form>
                <div class="pad_left1">
                    <h2>Course</h2>
                </div>
                <h:dataTable value="#{studentCourseController.items}" var="item" class="list1">
                    <h:column>
                        <h:commandLink value="#{item.course.courseName}" action="#{courseController.prepareViewFromProfile(item.course.courseName)}">
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:form>
        </ui:define>
        <ui:define name="bottom">
            <h:form>
                <script type="text/javascript">
                    //For calendar
                    $(function() {
                        $("#DOB").datepicker({
                            dateFormat: 'mm/dd/yy',
                            showOn: "button"
                        });
                    });
                </script>
            </h:form>
        </ui:define>
    </ui:composition>
</html>
